package cn.javass.framework.ioc.core;

import java.util.HashMap;
import java.util.Map;

import java.util.Set;
import java.util.Map.Entry;

import cn.javass.framework.aop.interceptor.Interceptor;

public class Container {
	private static Map<String, Object> beansMap = new HashMap<String, Object>();
	private static Map<Class, Object> interceptorsMap = new HashMap<Class, Object>();
	private static Map<String, BeanDefinition> beanDefinitions = new HashMap<String, BeanDefinition>();
	private static Map<String, Object> interceptors = new HashMap<String, Object>();

	public static Map<String, BeanDefinition> getBeanDefinitions() {
		return beanDefinitions;
	}

	public static void setBeanDefinitions(
			Map<String, BeanDefinition> beanDefinitions) {
		Container.beanDefinitions = beanDefinitions;
	}

	public static Map<String, Object> getInterceptors() {
		return interceptors;
	}

	public static void setInterceptors(Map<String, Object> interceptors) {
		Container.interceptors = interceptors;
	}

	public static void putBean(String id, Object bean) {
		beansMap.put(id, bean);
	}

	public static Object getBean(String id) {
		return beansMap.get(id);
	}

	public static void putInterceptor(Class clazz, Object instance) {
		interceptorsMap.put(clazz, instance);
	}

	public static Interceptor getInterceptor(Class clazz) {
		return (Interceptor) interceptorsMap.get(clazz);
	}

	public static Set<Entry<String, Object>> beanEntrySet() {
		return beansMap.entrySet();
	}

	public static Set<Entry<Class, Object>> interceptornEntrySet() {
		return interceptorsMap.entrySet();
	}

}
